class Dorp {
	constructor(box, doc) {
		this.box = document.querySelector(box);
		this.doc = doc;
	}
	show() {
		var oDiv = this.box;
		var doc = this.doc;
		this.box.onmousedown = function(ev) {
			//                   console.log(this)
			var ev = ev || ev.event;
			var x = ev.clientX - this.offsetLeft;
			//                   console.log(x)
			var y = ev.clientY - this.offsetTop;
			doc.onmousemove = function(ev) {
				var ev1 = ev || ev.event;
				oDiv.style.left = ev1.clientX - x + "px";
				oDiv.style.top = ev1.clientY - y + "px";
			}
			doc.onmouseup = function() {
				document.onmousemove = null;
			}
			return false;
		}
	}
}

export default Dorp;